package swa2012.telco.broker.beans;

import swa2012.telco.broker.beans.Provider;

public class Client {
	private String id;
	private Provider provider;
	
	public Client() {		
	}
	
	public Client(String id, Provider provider) {		
		this.id = id;
		this.provider = provider;
	}		
	
	public String getID() {
		return id;
	}
	public void setID(String id) {
		this.id = id;
	}
	public Provider getProvider() {
		return provider;
	}
	public void setProvider(Provider provider) {
		this.provider = provider;
	}
	
	@Override
	public String toString() {
		return this.getClass().getSimpleName()+"["+this.id+"@"+this.provider+"]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result
				+ ((provider == null) ? 0 : provider.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Client other = (Client) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (provider == null) {
			if (other.provider != null)
				return false;
		} else if (!provider.equals(other.provider))
			return false;
		return true;
	}
}
